var React = require('react');
var Icon = require('../Icon');
var Input = require('../Input');
var FilterItem = require('../filter/FilterItem');

module.exports = React.createClass({
	displayName:'TableFilter',
	getInitialState:function(){
		return {

		}
	},
	componentDidMount:function(){

	},
	__itemRender: function (item, index){
		var _content = null;
		switch (item.type) {
			case 'checkbox':
				_content = <Icon icon="fa-filter" />;
				break;
			default:
				_content = <Input {...item} />;
				break;
		}

		return <td key={index} className={'text-align-'+(item.textAlign||'left')} width={(item.width?item.width:0)}>{_content}</td>
	},
	render:function(){
		return (
			<tr className="row editable filter">
				{
					(this.props.items||[]).map(this.__itemRender)
				}
			</tr>
		);
	}
});
